﻿using System;
using System.Collections.Generic;
using System.Text;

using DotSpatial.Data;
using DotSpatial.Topology;



namespace HaGisPack
{
    [Serializable ]
    public class FRectangleShape : FShape
    {

        /// <summary>
        /// 已知四个点求长、宽、角度
        /// </summary>
        /// <param name="Points"></param>
        /// <param name="id"></param>
        public FRectangleShape( Coordinate[] Points, string id)
            : base(id)
        {
            this.normalPts.Clear();
            this.KeyPts.Clear();

            this.normalPts.AddRange(Points);
            this.KeyPts.AddRange(Points);

            //Arithmetic.Point[] pts = new Arithmetic.Point[3];
            //for (int i = 0; i < Points.Length; i++)
            //{
            //    pts[i].X = Points[i].X;
            //    pts[i].Y = Points[i].Y;
            //}

            //Arithmetic.MyArithmetic.GetRectPara(pts, ref this._XLength, ref this._YLength, ref this._Angle);
 
        }

        /// <summary>
        /// 已知第一点、长、宽、角度求四个点
        /// </summary>
        /// <param name="FirstPoint"></param>
        /// <param name="XLength"></param>
        /// <param name="YLength"></param>
        /// <param name="Angle"></param>
        /// <param name="id"></param>
        public FRectangleShape(Coordinate FirstPoint,double XLength,double YLength,double Angle,string id)
            : base(id)
        {
                     

            Coordinate[] RectPoints = new Coordinate[3];
            RectPoints = MyArithmetic.GetRectPoint(FirstPoint, XLength, YLength, Angle);

            this.normalPts.AddRange(RectPoints);
            this.KeyPts.AddRange(RectPoints);
          

        }



        //private double _XLength;

        //public double XLength
        //{
        //    get { return _XLength; }
        //    set { _XLength = value; }
        //}

        //private double _YLength;

        //public double YLength
        //{
        //    get { return _YLength; }
        //    set { _YLength = value; }
        //}

        //private double _Angle;

        ////单位 度
        //public double Angle
        //{
        //    get { return _Angle; }
        //    set { _Angle = value; }
        //}

        //private Coordinate _FirstPoint;

        //public Coordinate FirstPoint
        //{
        //    get { return _FirstPoint; }
        //    set { _FirstPoint = value; }
        //}



    }
}
